/* eslint-disable react/prop-types */
import React from 'react';
import { BrowserRouter, Route, Redirect, Switch, withRouter } from 'react-router-dom';
import Dict from '@/pages/mysite/system/dict/index'
import DictDetail from '@/pages/mysite/system/dict/detail'
import Home from '@/pages/mysite/system/home/index'
import Logger from '@/pages/mysite/system/logger/index'
import Menu from '@/pages/mysite/system/menu/index'
import MenuDetail from '@/pages/mysite/system/menu/detail'
import Role from '@/pages/mysite/system/role/index'
import RoleDetail from '@/pages/mysite/system/role/detail'
import Struct from '@/pages/mysite/system/struct/index'
import StructDetail from '@/pages/mysite/system/struct/detail'
import Task from '@/pages/mysite/system/task/index'
import TaskDetail from '@/pages/mysite/system/task/detail'
import User from '@/pages/mysite/system/user/index'
import UserDetail from '@/pages/mysite/system/user/detail'
import Docs from '@/pages/mysite/tools/docs/index'
import DocsDetail from '@/pages/mysite/tools/docs/detail'
import Example from '@/pages/mysite/tools/example/index'
import ExampleDetail from '@/pages/mysite/tools/example/detail'
import Plugin from '@/pages/mysite/tools/plugin/index'
import PluginDetail from '@/pages/mysite/tools/plugin/detail'
import NotFound from '@/pages/notFound'


class AppRouter extends React.Component {
    render() {
        return (
            <BrowserRouter basename="/" key={this.props.location.key}>
                <Switch>
                    {/* 系统管理 */}
                    <Route exact path="/index" component={Home} />
                    <Route exact path="/system/dict" component={Dict} />
                    <Route exact path="/system/dict/handle" component={DictDetail} />
                    <Route exact path="/system/logger" component={Logger} />
                    <Route exact path="/system/menu" component={Menu} />
                    <Route exact path="/system/menu/handle" component={MenuDetail} />
                    <Route exact path="/system/role" component={Role} />
                    <Route exact path="/system/role/handle" component={RoleDetail} />
                    <Route exact path="/system/struct" component={Struct} />
                    <Route exact path="/system/struct/handle" component={StructDetail} />
                    <Route exact path="/system/task" component={Task} />
                    <Route exact path="/system/task/handle" component={TaskDetail} />
                    <Route exact path="/system/user" component={User} />
                    <Route exact path="/system/user/handle" component={UserDetail} />
                    {/* 开发工具 */}
                    <Route exact path="/tools/docs" component={Docs} />
                    <Route exact path="/tools/docs/handle" component={DocsDetail} />
                    <Route exact path="/tools/example" component={Example} />
                    <Route exact path="/tools/example/handle" component={ExampleDetail} />
                    <Route exact path="/tools/plugin" component={Plugin} />
                    <Route exact path="/tools/plugin/handle" component={PluginDetail} />
                    {/* 404 */}
                    <Route exact path="/notFound" component={NotFound} />
                    <Route exact path="/*">
                        <Redirect to="/notFound"></Redirect>
                    </Route>
                </Switch>
            </BrowserRouter>
        )
    }
}

export default withRouter(AppRouter);
